<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/acceptOrder.css"/>
		<script src="js/jquery-2.1.0.js"></script>
		<script>
			<!-- 将数据从数据库全部提取出来-->
			$.ajax("/fengwei/PreOrder/getAll",{
				type:"get",
				data:{

				},
				success:function(data){
					console.log(data)

					var dataObj = eval('('+data+')');
					for(var i = 0;i<dataObj.length;i++){
						var order_goods = document.getElementById('order_box');
						var newDiv = document.createElement('div');//创建一个新的div
						newDiv.setAttribute('id', 'order_goods');
						newDiv.setAttribute('class', dataObj[i].preorderId);
						order_goods.appendChild(newDiv);
						newDiv.innerHTML = "<div class='order_goods_msg'>名称：<span class='goods_name'>"+dataObj[i].preorderName+"</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
								"产地：<span class='goods_place'>"+dataObj[i].preorderCity+"</span> <br />" +
								"收货地址：<span class='goods_school'>"+dataObj[i].preorderAdess+"</span><br />" +
								"截止时间：<span class='goods_time'>"+dataObj[i].preorderCuttime+"</span> <br />" +
								"总价格：<span class='goods_price'>￥"+dataObj[i].preoderTotalprice+"</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
								"数量：<span class='goods_num'>"+dataObj[i].preorderCount+dataObj[i].preoderUnit+"</span><br />" +
								"<div id='jd_img'>" +
								"<a id = 'get' _id='"+dataObj[i].preorderId+"'><img src='img/jd.jpg'/></a>" +
								"</div>" +
								"</div>";
					}
//					将数据插入页面之后执行的接单行为
					acceptClick()
				},
				error:function(){
					alert(0)
				}
			})

			function acceptClick(){
				var getButton = $("#get");
				getButton.click(function(){
					var preId = $(this).attr("_id");
//					通过id来删除一条
					$.ajax("/fengwei/PreOrder/change",{
						type:'post',
						data:{
							'preorderId':preId
						},
						success:function(){
//							跳转页面
							window.location.href = "goToPerson.html";

						},
						error:function(){
							alert("不是卖家，没有接单权限！")
						}
					})
				})
			}
		</script>
	</head>
	<body>
		<div id="head">
			<a href=”#” onClick="javascript :history.back(-1);"> <img class="img_return" src="img/return.png"/> </a>
			<span class="head_txt">接受订单</span>
		</div>
		
		<div id="order_box">
			<!--<div id="order_goods">-->
				<!--<div class="order_goods_msg">名称：<span class="goods_name">大闸蟹</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
								  	      <!--产地：<span class="goods_place">成都</span> <br />-->
								  	      <!--所在学校：<span class="goods_school">四川省省成都市郫县区县西华学校1231324寝室号</span><br />-->
								  	      <!--截止时间：<span class="goods_time">2017.3.3</span> <br />-->
								  	      <!--总价格：<span class="goods_price">￥50</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
	 								       <!--数量：<span class="goods_num">6kg</span><br />-->

	 				<!--<div id="jd_img">-->
						<!--<a href="###"><img src="img/jd.jpg"/></a>-->
					<!--</div>-->
				<!--</div>-->
			<!--</div>   &lt;!&ndash;box end&ndash;&gt;-->
			
			<!--<div id="order_goods">-->
				<!--<div class="order_goods_msg">名称：<span class="goods_name">大闸蟹</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
								  	      <!--产地：<span class="goods_place">成都</span> <br />-->
								  	      <!--所在学校：<span class="goods_school">四川省 成都市 四川旅游学院</span><br />-->
								  	      <!--截止时间：<span class="goods_time">2017.3.3</span> <br />-->
								  	      <!--总价格：<span class="goods_price">￥50</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
	 								       <!--数量：<span class="goods_num">6kg</span><br />-->
	 								        <!-- -->
	 				<!--<div id="jd_img">-->
						<!--<a href="###"><img src="img/jd.jpg"/></a>-->
					<!--</div>-->
				<!--</div>	-->
			<!--</div>   &lt;!&ndash;box end&ndash;&gt;-->
			<!-- -->
			<!--<div id="order_goods">-->
				<!--<div class="order_goods_msg">名称：<span class="goods_name">大闸蟹</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
								  	      <!--产地：<span class="goods_place">成都</span> <br />-->
								  	      <!--所在学校：<span class="goods_school">四川省 成都市 四川旅游学院</span><br />-->
								  	      <!--截止时间：<span class="goods_time">2017.3.3</span> <br />-->
								  	      <!--总价格：<span class="goods_price">￥50</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
	 								       <!--数量：<span class="goods_num">6kg</span><br />-->
	 								        <!-- -->
	 				<!--<div id="jd_img">-->
						<!--<a href="###"><img src="img/jd.jpg"/></a>-->
					<!--</div>-->
				<!--</div>	-->
			<!--</div>   &lt;!&ndash;box end&ndash;&gt;-->
			<!-- -->
			<!--<div id="order_goods">-->
				<!--<div class="order_goods_msg">名称：<span class="goods_name">大闸蟹</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
								  	      <!--产地：<span class="goods_place">成都</span> <br />-->
								  	      <!--所在学校：<span class="goods_school">四川省 成都市 四川旅游学院</span><br />-->
								  	      <!--截止时间：<span class="goods_time">2017.3.3</span> <br />-->
								  	      <!--总价格：<span class="goods_price">￥50</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
	 								       <!--数量：<span class="goods_num">6kg</span><br />-->
	 								        <!-- -->
	 				<!--<div id="jd_img">-->
						<!--<a href="###"><img src="img/jd.jpg"/></a>-->
					<!--</div>-->
				<!--</div>	-->
			<!--</div>   &lt;!&ndash;box end&ndash;&gt;-->
			<!-- -->
			<!--<div id="order_goods">-->
				<!--<div class="order_goods_msg">名称：<span class="goods_name">大闸蟹</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
								  	      <!--产地：<span class="goods_place">成都</span> <br />-->
								  	      <!--所在学校：<span class="goods_school">四川省 成都市 四川旅游学院</span><br />-->
								  	      <!--截止时间：<span class="goods_time">2017.3.3</span> <br />-->
								  	      <!--总价格：<span class="goods_price">￥50</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
	 								       <!--数量：<span class="goods_num">6kg</span><br />-->
	 								        <!-- -->
	 				<!--<div id="jd_img">-->
						<!--<a href="###"><img src="img/jd.jpg"/></a>-->
					<!--</div>-->
				<!--</div>	-->
			<!--</div>   &lt;!&ndash;box end&ndash;&gt;-->
			
			
			
			
			
			
		</div>
		
	</body>
</html>
